﻿<%@ Page Language="C#" MasterPageFile="~/MainMaster.Master" AutoEventWireup="true" CodeBehind="SpecialSubType.aspx.cs" Inherits="Mang24k99.Web.SpecialManage.SpecialSubType" Title="专题新闻类别维护" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <script type="text/javascript" language="JavaScript">
          function verify(obj)
          {
              if(!(obj.keyCode>=48 && obj.keyCode<=57))
              {
                  obj.returnValue = false;
              } 
          }
          function filterSpace(obj)
          {
               if (obj.keyCode==32)
               {
                   obj.returnValue=false;
               }
          }
          
          function warn(obj)
          {
                var patrn=/^[0-9]{1,20}$/; 
                if (!patrn.exec(obj.value))
                { 
                    alert("条目数格式不对，请输入数字！");
                    return false;
                } 
                return true ;
          }
          function PageValidate()
          {
              var txtType=document.getElementById("ctl00_ContentPlaceHolder1_txtType");
              var txtName=document.getElementById("ctl00_ContentPlaceHolder1_txtName");
              var txtNum=document.getElementById("ctl00_ContentPlaceHolder1_txtNum");
              var txtTitleDisplay=document.getElementById("ctl00_ContentPlaceHolder1_txtTitleDisplay");
              var txtAddrssDisplay=document.getElementById("ctl00_ContentPlaceHolder1_txtAddrssDisplay");
              var patrn=/^[0-9]{1,20}$/; 
              if(txtType.value==""||txtType.value==0)
              {
                alert("类型编号不能为0或空");
                return false;
              }
              if(!patrn.exec(txtType.value))
              {
                    alert("类型编号格式不对，请输入数字！");
                    return false;
              }
              if (txtName.value=="")
              {
              
                 alert("类型名称不能为空！");
                 return  false;
              }
              
              
               if (!patrn.exec(txtNum.value))
                { 
                    alert("条目数格式不对，请输入数字！");
                    return false;
                } 
              if (txtNum.value==""||txtNum.value==0)
              {
                  alert("条目数不能为0或空!");
                  return false;
              }
              if (txtTitleDisplay.value=="" )
              {
                   alert("内容显示标题不能为空！");
                   return false;
              }
              if (txtAddrssDisplay.value=="")
              {
                    alert("地址显示标题不能为空！");
                    return false;
              }
              return true;
          }

      </script>
    <div>
        <asp:Panel ID="Panel1" runat="server">
            <asp:Button ID="btnBack" CssClass="form_btn" runat="server" Text="返回上一页" 
                onclick="btnBack_Click" />
            <table>
                <tr>
                    <td class="tb_title1">
                        类型编号：
                    </td>
                    <td class="tb_txt1">
                        <asp:TextBox ID="txtType" runat="server" onpaste = "return false" autocomplete="off"  
                         onkeypress="verify(event)" MaxLength="3"></asp:TextBox>
                         <asp:TextBox ID="txtHType" runat="server" Style="display: none"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="tb_title1">
                        类型名称：
                    </td>
                    <td class="tb_txt1">
                        <asp:TextBox ID="txtName" runat="server" onpaste = "return false" autocomplete="off"  
                         onkeypress="filterSpace(event)"  MaxLength="20"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="tb_title1">
                        条目数：
                    </td>
                    <td class="tb_txt1">
                        <asp:TextBox ID="txtNum" runat="server" onpaste = "return false" autocomplete="off"  
                         onkeypress="verify(event)" onblur="warn(this)"  MaxLength="3"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="tb_title1">
                        内容显示标题：
                    </td>
                    <td class="tb_txt1">
                        <asp:TextBox ID="txtTitleDisplay" runat="server" onpaste = "return false" autocomplete="off"  
                         onkeypress="filterSpace(event)" MaxLength="20"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="tb_title1">
                        地址显示标题：
                    </td>
                    <td class="tb_txt1">
                        <asp:TextBox ID="txtAddrssDisplay" runat="server" onpaste = "return false" autocomplete="off"  
                         onkeypress="filterSpace(event)" MaxLength="20"></asp:TextBox>
                    </td>
                </tr>    
                <tr>
                    <td colspan="2" align="center">
                        <asp:Button CssClass="form_btn" ID="btnSave" runat="server" Text="保存" 
                            OnClientClick="return PageValidate()" onclick="btnSave_Click" />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:Button CssClass="form_btn" ID="btnCancel" runat="server" Text="取消" 
                            onclick="btnCancel_Click" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <asp:Panel ID="Panel2" runat="server">
            <asp:Button CssClass="form_btn" ID="btnAdd" runat="server" Text="新增" 
                onclick="btnAdd_Click" />
            <div>
                <asp:GridView ID="grdList" runat="server"  OnRowDeleting="grdList_RowDeleting" 
                    AutoGenerateColumns="False" Width="100%"
                    onselectedindexchanged="grdList_SelectedIndexChanged">
                    <HeaderStyle CssClass="tb_title2" />
                    <RowStyle CssClass="tb_txt2" />
                     <Columns>
                        <asp:TemplateField HeaderText="序号">
                            <ItemTemplate>
                                <%#Container.DataItemIndex+1%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="SubjectType" HeaderText="类型编号" />
                        <asp:BoundField DataField="SubjectTypename" HeaderText="类型名称" />
                        <asp:BoundField DataField="TitleDisplay" HeaderText="显示标题" />
                        <asp:BoundField DataField="AddresDsplay" HeaderText="显示地址" />
                        <asp:BoundField DataField="DisplayNum" HeaderText="显示条数" />
                        <asp:ButtonField ButtonType="link" CommandName="Select" HeaderText="编辑" ShowHeader="True"
                            Text="编辑" />
                        <asp:CommandField DeleteText="&lt;div id=&quot;de&quot; onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;&gt;删除&lt;/div&gt; "
                            HeaderText="删除" ShowDeleteButton="True" />
                    </Columns>
                </asp:GridView>
            </div>
            <div>
                <webdiyer:AspNetPager ID="AspNetPager1" runat="server" PageSize="8" FirstPageText="首页"
	                LastPageText="尾页" NextPageText="下一页" OnPageChanged="AspNetPager1_PageChanged"
	                PrevPageText="上一页" ShowInputBox="Always" SubmitButtonText="GO" AlwaysShow="True"
	                CssClass="AspNetPager" CustomInfoHTML="  共&lt;span class=&quot;AspNetPager_current&quot;&gt;{0}&lt;/span&gt;页"
	                CurrentPageButtonClass="AspNetPager_current" CustomInfoClass="" HorizontalAlign="Right"
	                InputBoxClass="AspNetPager_txt" SubmitButtonClass="AspNetPager_btn" CurrentPageButtonStyle="AspNetPager"
	                PagingButtonSpacing="1px" ShowCustomInfoSection="Right">
                </webdiyer:AspNetPager>
            </div>
        </asp:Panel>
    </div>
</asp:Content>
